import 'package:backend.core/core/domain/entities/app_store/app_store_transaction_offer_type.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction_offer_type.dart';

abstract class CreateAppStoreTransactionOfferTypeFromApiOne {
  AppStoreTransactionOfferType call({
    required AppStoreApiTransactionOfferType apiOfferType,
  });
}

class CreateAppStoreTransactionOfferTypeFromApiOneImpl
    implements CreateAppStoreTransactionOfferTypeFromApiOne {
  const CreateAppStoreTransactionOfferTypeFromApiOneImpl();

  @override
  AppStoreTransactionOfferType call({
    required AppStoreApiTransactionOfferType apiOfferType,
  }) {
    switch (apiOfferType) {
      case AppStoreApiTransactionOfferType.regular:
        return AppStoreTransactionOfferType.regular;
      case AppStoreApiTransactionOfferType.introductory:
        return AppStoreTransactionOfferType.introductory;
      case AppStoreApiTransactionOfferType.promotional:
        return AppStoreTransactionOfferType.promotional;
      case AppStoreApiTransactionOfferType.subscriptionCode:
        return AppStoreTransactionOfferType.subscriptionCode;
    }
  }
}
